{template 'common/header'}
<ul class="nav nav-tabs">
	<li{if $_GPC['ty'] == '' && $_GPC['do'] == 'votelist' && $_GPC['ranking'] == ''  } class="active"{/if}><a href="{php echo $this->createWebUrl('votelist',array('rid'=>$_GPC['rid']));}">全部投票</a></li>
    <li{if $_GPC['ty'] == '0'} class="active"{/if}><a href="{php echo $this->createWebUrl('votelist',array('rid'=>$_GPC['rid'],'ty'=>0));}">待审核</a></li>
	<li{if $_GPC['ty'] == '1'} class="active"{/if}><a href="{php echo $this->createWebUrl('votelist',array('rid'=>$_GPC['rid'],'ty'=>1));}">已审核</a></li>
	<li{if $_GPC['ranking'] == '0'} class="active"{/if}><a href="{php echo $this->createWebUrl('votelist',array('rid'=>$_GPC['rid'],'ranking'=>0));}">票数排行</a></li>
	<li{if $_GPC['ranking'] == '1'} class="active"{/if}><a href="{php echo $this->createWebUrl('votelist',array('rid'=>$_GPC['rid'],'ranking'=>1));}">钻石排行</a></li>
	<li{if $_GPC['ranking'] == '1'} class="active"{/if}><a href="{php echo $this->createWebUrl('votedata',array('rid'=>$_GPC['rid'],'ty'=>order));}">全部订单</a></li>
	<li{if $_GPC['do'] == 'edit'} class="active"{/if}><a href="{php echo $this->createWebUrl('edit',array('id'=>$_GPC['id'],'rid'=>$_GPC['rid']));}">{if $_GPC['id'] > 0}编辑投票用户{else}添加投票用户{/if}</a></li>
</ul>
<div class="clearfix">
	<form action="" method="post" class="form-horizontal form" enctype="multipart/form-data" id="form1">
		<div class="panel panel-default" id="step1">
			<div class="panel-heading">
				参加投票信息
			</div>
			<div class="panel-body">
			     <div class="form-group">
				  <label class="col-xs-12 col-sm-3 col-md-2 control-label">头像</label>
				  <div class="col-sm-9">
					{php echo tpl_form_field_image('avatar',$votedata['avatar'],'', $options);}
					<div class="help-block">投票显示头像，建议80*80</div>
				  </div>
				</div>
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label"><span class="text-danger">*</span> 姓名</label>
					<div class="col-sm-8 col-xs-12">
						<input type="text" class="form-control" name="name" value="{$votedata['name']}"/>
						<span class="help-block"></span>
					</div>
				</div>
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label"><span class="text-danger">*</span>手机号</label>
					<div class="col-sm-8 col-xs-12">
						<input type="text" class="form-control" name="mobile" value="{$votedata['mobile']}"/>
					</div>
				</div>
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label">性别</label>
					<div class="col-sm-8 col-xs-12">
						<label class="radio-inline">
						<input type="radio" name="sex" value="2" {if $votedata['sex']=='2'} checked {/if} />女
					</label>
					<label class="radio-inline">
						<input type="radio" name="sex" value="1" {if $votedata['sex']=='1'} checked {/if}  />男
					</label>
					
					</div>
				</div>
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label">票数</label>
					<div class="col-sm-8 col-xs-12">
						<input type="text" class="form-control" name="votenum" value="{$votedata['votenum']}"/>
					</div>
				</div>
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label">钻石数量</label>
					<div class="col-sm-8 col-xs-12">
						<input type="text" class="form-control" name="diamondnum" value="{$votedata['diamondnum']}"/>
					</div>
				</div>
				<div class="form-group">
          <label class="col-xs-12 col-sm-3 col-md-2 control-label">图片</label>
          <div class="col-sm-9">
				
				<div class="row">
				  <div class="col-xs-6 col-md-2">
					<a href="javascript:;" class="thumbnail">
					  <img src="{php echo tomedia($votedata['img1']);}" width="100%" >
					  <input type="hidden" value="{php echo tomedia($votedata['img1']);}" name="img1">
					</a>
				  </div>
				  <div class="col-xs-6 col-md-2">
					<a href="javascript:;"  class="thumbnail">
					  <img src="{php echo tomedia($votedata['img2']);}" width="100%" >
					  <input type="hidden" value="{php echo tomedia($votedata['img2']);}" name="img2">

					  
					</a>
				  </div>
				  <div class="col-xs-6 col-md-2">
					<a href="javascript:;"  class="thumbnail">
					  <img src="{php echo tomedia($votedata['img3']);}" width="100%" >
					  <input type="hidden" value="{php echo tomedia($votedata['img3']);}" name="img3">
	
					</a>
				  </div>
				  <div class="col-xs-6 col-md-2">
					<a href="javascript:;"  class="thumbnail">
					  <img src="{php echo tomedia($votedata['img4']);}" width="100%" >
					  <input type="hidden" value="{php echo tomedia($votedata['img4']);}" name="img4">
	
					</a>
				  </div>
				  <div class="col-xs-6 col-md-2">
					<a href="javascript:;"  class="thumbnail">
					  <img src="{php echo tomedia($votedata['img5']);}" width="100%" >
					  <input type="hidden" value="{php echo tomedia($votedata['img5']);}" name="img5">

					</a>
				  </div>
				  <script type="text/javascript">
				require(['jquery', 'util'], function($, util){
					$(function(){
						// 对象绑定点击事件
						$('.thumbnail img').click(function(){
						    thimg=$(this);
							util.image('',function(data){
								thimg.attr("src",data['url']);
								thimg.next().val(data['url']);
							});
						});
					});
				});
               </script>
				</div>
                
		  </div>
        </div>
	    
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label"><span class="text-danger"></span><span class="text-danger">*</span>简介</label>
					<div class="col-sm-8 col-xs-12">
						<textarea name="introduction" class="form-control js-a" cols="30" rows="3">{$votedata['introduction']}</textarea>
					</div>
				</div>
								<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label">审核</label>
					<div class="col-sm-8 col-xs-12">
						<label class="radio-inline">
						<input type="radio" name="status" value="0" {if $votedata['status']=='0'} checked {/if} />否
					</label>
					<label class="radio-inline">
						<input type="radio" name="status" value="1" {if $votedata['status']=='1'} checked {/if}  />是
					</label>
					
					</div>
				</div>
			
			</div>
          </div>
        </div>

		<div class="form-group col-sm-12">
			<input name="submit" id="submit" type="submit" value="提交" class="btn btn-primary col-lg-1">
			<input type="hidden" name="token" value="{$_W['token']}" />
		</div>
	</form>
</div>

<script>
	$('#form1').submit(function() {
		if(!$.trim($(':text[name="name"]').val())) {
			util.message('请填写姓名');
			return false;
		}
		if(!$.trim($(':text[name="img1"]' || !$.trim($(':text[name="img2"]').val())) {
			util.message('请上传第一张和第二张图片');
			return false;
		}
		if(!$.trim($(':text[name="mobile"]').val())) {
			util.message('请填写手机号');
			return false;
		}
		 
	});

	
</script>
{template 'common/footer'}
